import axios from 'axios';
// import { JNhadoop } from '../../public/config.js' 
// console.log(JNhadoop.apiBaseUrl)
// import qs from 'qs'
import {
	Message
} from 'element-ui'
const env = process.env;
// 创建axios实例
const service = axios.create({
	baseURL: env.VUE_APP_server,
});
console.log(env.VUE_APP_server)
// request拦截器
service.interceptors.request.use(config => {
	// config.data = qs.stringify(config.data, {arrayFormat: 'repeat'})
	return config;
}, error => {
	console.log(error); // for debug
	Promise.reject(error);
});

// respone拦截器
service.interceptors.response.use(
	response => {
		let data = response.data
		if (data.code != 200 && data.code != 777) {

			Message.error(data.msg)
		}
		return response.data;
	},
	error => {
		return Promise.reject(error);
	}
);
export default service;